﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WxxMail.Domain;
using WxxMail.IBLL;

namespace WxxMail.BLL
{
    public partial class LoginService : BaseService<Login>, ILoginService
    {
        private readonly ArticleEntities _articleEntities=new ArticleEntities ();
        public bool isValue(Login login)
        {
            if (login == null)
            {
                throw new ArgumentNullException("Login");
            }
            using (var dbContext = new ArticleEntities())
            {
                //var data = from p in _articleEntities.Logins
                //           where p.LoginId == login.LoginId & p.Pass == login.Pass
                //           select p;
                var data = dbContext.Logins
                                    .Where(item=>item.LoginId== login.LoginId && item.Pass == login.Pass);
                if (data.Count()==0)
                    return false;
                else
                    return true;
            }
           
        }
    }
}
